package com.lq.tech.service.index;

import com.lq.tech.infra.PageCommonVO;
import com.lq.tech.infra.SearchCommonVO;
import com.lq.tech.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lq.tech.dao.entity.index.IndexSlideshowDO;
import com.lq.tech.dao.mapper.index.IndexSlideshowMapper;
import com.lq.tech.service.vo.index.IndexSlideshowVO;
import com.lq.tech.infra.ErrorCode;

import javax.annotation.PostConstruct;
import java.util.List;

@Service
public class IndexSlideshowService extends BaseService<IndexSlideshowVO, IndexSlideshowDO>
{
    @Autowired
    private IndexSlideshowMapper indexSlideshowMapper;

    public IndexSlideshowService()
    {
        super(IndexSlideshowVO.class, IndexSlideshowDO.class);
    }

    @PostConstruct
    public void init()
    {
        super.addMapper(indexSlideshowMapper);
    }

    @Override
    public IndexSlideshowVO item(String id)
    {
        return super.item(id);
    }

    @Override
    public PageCommonVO list(SearchCommonVO<IndexSlideshowVO> condition)
    {
        return super.list(condition);
    }

    @Override
    public ErrorCode insert(IndexSlideshowVO indexSlideshow)
    {
        return super.insert(indexSlideshow);
    }

    @Override
    public ErrorCode update(IndexSlideshowVO indexSlideshow)
    {
        return super.update(indexSlideshow);
    }

    /**
     * 查询首页轮播图列表
     *
     * @return List<IndexSlideshowVO>
     */
    public List<IndexSlideshowVO> listSlideshow()
    {
        List<IndexSlideshowDO> indexSlideshowDOList = indexSlideshowMapper.listSlideshow();

        List<IndexSlideshowVO> slideshowVOList = getVOList(indexSlideshowDOList);
        return slideshowVOList;
    }
}
